#include <functions\core_macros.h>

["TYR"] call IFUNC(register);

if (isServer) then {
	GVAR(ARTY_DELAY) = TYR_Artillery_Delay;
	GVAR(ARTY_RELOAD_DELAY) = TYR_Artillery_Reload_Delay;
	GVAR(ARTY_AVAILABLE_WEST) = 0 - GVAR(ARTY_DELAY);
	GVAR(ARTY_AVAILABLE_EAST) = 0 - GVAR(ARTY_DELAY);
	GVAR(ARTY_AVAILABLE_EAST) = 0 - GVAR(ARTY_DELAY);
	
	["TYR",QGVAR(CALLARTY),QUOTE(FUNC(pveh))] call IFUNC(handlerAdd);
};

if (!isDedicated && hasInterface && !isnil "tyr_fnc_addHandler") then {
	["TYRMENU",
		[[
			localize "STR_TYR_ARTY_MENU_RADIO"
			,{if (!isnil "mp_rights_fnc_hasRoles") then { [(getPlayerUID player),['leader','admin','artillery']] call mp_rights_fnc_hasRoles} else { true }}
			,{[] call FUNC(request)}
			,"tmf\support\modules\tyr_artillery\artillery.paa"
			,10
		]]
	] call tyr_fnc_addHandler;
};


if (!isDedicated && hasInterface) then {
	if (isnil "PAPABEAR") then { PAPABEAR = [playerSide,"HQ"]; };

	GVAR(ARTY_MARKER) = createMarkerLocal [QGVAR(ARTY_MARKER), [0,0,0] ];
	GVAR(ARTY_MARKER) setMarkerColorLocal "ColorRed";
	GVAR(ARTY_MARKER) setMarkerShapeLocal "ICON";
	GVAR(ARTY_MARKER) setMarkerTypeLocal "mil_destroy";
	GVAR(ARTY_MARKER) setMarkerDirLocal 36;
	GVAR(ARTY_MARKER) setMarkerAlphaLocal 0;
	GVAR(ARTY_MARKER) setMarkerTextLocal (localize "STR_TYR_ARTY_MARKER");
	
	["TYR",QGVAR(INFORMPLAYER),QUOTE(FUNC(pveh))] call IFUNC(handlerAdd);
};
